﻿using BrightSword.LightSaber;
using Microsoft.VisualStudio.TestTools.UnitTesting;

namespace Test.LightSaber
{
    /// <summary>
    ///This is a test class for ParserTest and is intended
    ///to contain all ParserTest Unit Tests
    ///</summary>
    [TestClass]
    public class ParserTest
    {
        /// <summary>
        ///Gets or sets the test context which provides
        ///information about and functionality for the current test run.
        ///</summary>
        public TestContext TestContext { get; set; }

        /// <summary>
        ///A test for Parse
        ///</summary>
        [TestMethod]
        public void ParseTest()
        {
            Assert.AreEqual("( )".Parse(null, "test"), "test");
            Assert.AreEqual("(test a b)".Parse(null, "test"), "test");
            Assert.AreEqual("(test (f1 a b))".Parse(null, "test"), "test");
            Assert.AreEqual("(test (f1 a b) c)".Parse(null, "test"), "test");
            Assert.AreEqual("(test (f1 a b) c ( ))".Parse(null, "test"), "test");
            Assert.AreEqual("(+ (* 3.14159E2 -6.025E26) (/ 1.812E-27 -3.34E-35))".Parse(null, "test"), "test");
            Assert.AreEqual("(>= (f1 a b) /*(f2 c d)*/ 123.42E3)".Parse(null, "test"), "test");
            Assert.AreEqual("(test \"(f1 a b)\" (f2 c d))".Parse(null, "test"), "test");
            Assert.AreEqual("(test \'(f1 a b)\' (f2 c d))".Parse(null, "test"), "test");
            Assert.AreEqual("(a b (w ()) ())".Parse(null, "test"), "test");
            Assert.AreEqual("((((< a".Parse(null, "test"), null);
            Assert.AreEqual("(".Parse(null, "test"), null);
            Assert.AreEqual("(\'this is supposed to be a single quoted string\")".Parse(null, "test"), null);
            Assert.AreEqual("(\"this is supposed to be a double quoted string)".Parse(null, "test"), null);
            Assert.AreEqual("(()".Parse(null, "test"), null);
            Assert.AreEqual("((|||) b (&& a c) (! d)".Parse(null, "test"), null);
        }
    }
}